﻿package phpas3{

	public function preg_match( pattern:RegExp, subject:String, matches:Object=null ):int{
		var result:Object = pattern.exec( subject );
		if( result===null ){
			return null;
		}

		if( matches ){
			matches = result;
		}
		return result.index;
	}

}